﻿#ifndef U_SerialPort_H
#define U_SerialPort_H

#include <QSerialPort>
#include <QSerialPortInfo>

#include "Console/myobject.h"

class SerialPort : public MyObject
{
    Q_OBJECT
public:
    explicit SerialPort(Serial serial, QObject *parent = nullptr);

signals:
    void SerialSend(QByteArray);
    void SerialRead(QByteArray);

public slots:
    void Start();
    void Stop();
    void OnTimer();

    void CreateSerial();
    void SerialReadData();
    void SerialSendData(QByteArray data);
    bool SendData(QByteArray dataArray, QString retCheck);
    void LightStyle();

public:
    Serial      serial;
    bool        isOpen;
    QByteArray  readData;
    QSerialPort *serialPort;
};

#endif // U_SerialPort_H
